# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AccessApproval.V1.Model.ApprovalRequest do
  @moduledoc """
  A request for the customer to approve access to a resource.

  ## Attributes

  *   `approve` (*type:* `GoogleApi.AccessApproval.V1.Model.ApproveDecision.t`, *default:* `nil`) - Access was approved.
  *   `dismiss` (*type:* `GoogleApi.AccessApproval.V1.Model.DismissDecision.t`, *default:* `nil`) - The request was dismissed.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The resource name of the request. Format is "{projects|folders|organizations}/{id}/approvalRequests/{approval_request}".
  *   `requestTime` (*type:* `DateTime.t`, *default:* `nil`) - The time at which approval was requested.
  *   `requestedAugmentedInfo` (*type:* `GoogleApi.AccessApproval.V1.Model.AugmentedInfo.t`, *default:* `nil`) - This field contains the augmented information of the request.
  *   `requestedDuration` (*type:* `String.t`, *default:* `nil`) - The requested access duration.
  *   `requestedExpiration` (*type:* `DateTime.t`, *default:* `nil`) - The original requested expiration for the approval. Calculated by adding the requested_duration to the request_time.
  *   `requestedLocations` (*type:* `GoogleApi.AccessApproval.V1.Model.AccessLocations.t`, *default:* `nil`) - The locations for which approval is being requested.
  *   `requestedReason` (*type:* `GoogleApi.AccessApproval.V1.Model.AccessReason.t`, *default:* `nil`) - The justification for which approval is being requested.
  *   `requestedResourceName` (*type:* `String.t`, *default:* `nil`) - The resource for which approval is being requested. The format of the resource name is defined at https://cloud.google.com/apis/design/resource_names. The resource name here may either be a "full" resource name (e.g. "//library.googleapis.com/shelves/shelf1/books/book2") or a "relative" resource name (e.g. "shelves/shelf1/books/book2") as described in the resource name specification.
  *   `requestedResourceProperties` (*type:* `GoogleApi.AccessApproval.V1.Model.ResourceProperties.t`, *default:* `nil`) - Properties related to the resource represented by requested_resource_name.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :approve => GoogleApi.AccessApproval.V1.Model.ApproveDecision.t() | nil,
          :dismiss => GoogleApi.AccessApproval.V1.Model.DismissDecision.t() | nil,
          :name => String.t() | nil,
          :requestTime => DateTime.t() | nil,
          :requestedAugmentedInfo => GoogleApi.AccessApproval.V1.Model.AugmentedInfo.t() | nil,
          :requestedDuration => String.t() | nil,
          :requestedExpiration => DateTime.t() | nil,
          :requestedLocations => GoogleApi.AccessApproval.V1.Model.AccessLocations.t() | nil,
          :requestedReason => GoogleApi.AccessApproval.V1.Model.AccessReason.t() | nil,
          :requestedResourceName => String.t() | nil,
          :requestedResourceProperties =>
            GoogleApi.AccessApproval.V1.Model.ResourceProperties.t() | nil
        }

  field(:approve, as: GoogleApi.AccessApproval.V1.Model.ApproveDecision)
  field(:dismiss, as: GoogleApi.AccessApproval.V1.Model.DismissDecision)
  field(:name)
  field(:requestTime, as: DateTime)
  field(:requestedAugmentedInfo, as: GoogleApi.AccessApproval.V1.Model.AugmentedInfo)
  field(:requestedDuration)
  field(:requestedExpiration, as: DateTime)
  field(:requestedLocations, as: GoogleApi.AccessApproval.V1.Model.AccessLocations)
  field(:requestedReason, as: GoogleApi.AccessApproval.V1.Model.AccessReason)
  field(:requestedResourceName)
  field(:requestedResourceProperties, as: GoogleApi.AccessApproval.V1.Model.ResourceProperties)
end

defimpl Poison.Decoder, for: GoogleApi.AccessApproval.V1.Model.ApprovalRequest do
  def decode(value, options) do
    GoogleApi.AccessApproval.V1.Model.ApprovalRequest.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AccessApproval.V1.Model.ApprovalRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
